home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: tank.news.pipex.net!pipex!warwick!bsmail!talisker!nathan
- From: nathan@pact.srf.ac.uk (Nathan Sidwell)
- Subject: Re: Borland sqrt() bug?
- Message-ID: <Do3wzC.Fyw@uns.bris.ac.uk>
- Sender: usenet@uns.bris.ac.uk (Usenet news owner)
- Nntp-Posting-Host: talisker.pact.srf.ac.uk
- Organization: Inmos
- X-Newsreader: TIN [version 1.2 PL2]
- References: <4hotp5$a1h@news.hk.linkage.net> <3140A7EE.1DA3@hsc.unt.edu>
- Date: Mon, 11 Mar 1996 14:16:24 GMT
-
- Steve Fogoros (sfogoros@hsc.unt.edu) wrote:
- : Priscilla Ngie wrote:
- : >
- : > I tired the following code
- : >
- : > float num;
- : > if (num > 0) sqrt(num);
- : >
- : > and Borland C++ 4.02 returns me with an error
- : >
- : > sqrt: DOMAIN error
- : >
- : > This error dialog box only pops up when num is a +ve number approaching
- : > zero, eg 0.000000005.
- : >
-
- : sqrt() takes a double as its argument and returns a double. Declare num
- : as double or cast it to double.
-
- How will this change things? [If a prototype is in scope, floats will
- be promoted to doubles. If a prototype is not in scope, floats will
- be promoted to doubles.]
-
- sqrt is well defined for all positive values as well as both IEEE zeroes.
-
- nathan
- --
- Nathan Sidwell Holder of the Xmris home page
- Chameleon Architecture Group at SGS-Thomson, formerly Inmos
- http://www.pact.srf.ac.uk/~nathan/ Tel 0117 9707182
- nathan@inmos.co.uk or nathan@bristol.st.com or nathan@pact.srf.ac.uk
-